package indi.zhifa.study2025.class004.imgserv.dao.gen.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import indi.zhifa.engine.mpenhance.ann.ZfDbService;
import indi.zhifa.engine.mpenhance.service.impl.ZfDbServiceImpl;
import indi.zhifa.study2025.class004.imgserv.dao.gen.mapper.GenPictureMapper;
import indi.zhifa.study2025.class004.imgserv.dao.gen.service.IGenPictureDbService;
import indi.zhifa.study2025.class004.imgserv.entity.po.GenPictureEntity;

@ZfDbService(name = "图片数据")
public class GenPictureDbServiceImpl extends ZfDbServiceImpl<GenPictureMapper, GenPictureEntity> implements IGenPictureDbService {
    @Override
    public GenPictureEntity findByUrl(String pExtUrl, long pUrlFingerprint) {


        LambdaQueryWrapper<GenPictureEntity> queryWrapper = Wrappers.<GenPictureEntity>lambdaQuery()
                .eq(GenPictureEntity::getUrlFingerprint, pUrlFingerprint)
                .eq(GenPictureEntity::getUrl, pExtUrl);
        return findOne(queryWrapper);
    }

    @Override
    public GenPictureEntity findByImgFingerprint(String pFingerprint, String pMd5) {
        LambdaQueryWrapper<GenPictureEntity> queryWrapper = Wrappers.<GenPictureEntity>lambdaQuery()
                .eq(GenPictureEntity::getFileFingerprint, pFingerprint)
                .eq(GenPictureEntity::getImgMd5, pMd5);
        return findOne(queryWrapper);
    }
}
